﻿Public Class StatusOverview
  'Public Shared CountProperty As DependencyProperty = DependencyProperty.Register("Count", GetType(Integer), GetType(StatusOverview), New FrameworkPropertyMetadata(New PropertyChangedCallback(AddressOf OnCountChanged)))
  Public Shared HoursProperty As DependencyProperty = DependencyProperty.Register("Hours", GetType(Double), GetType(StatusOverview), New FrameworkPropertyMetadata(New PropertyChangedCallback(AddressOf OnHoursChanged)))
  'Public Shared StatusProperty As DependencyProperty = DependencyProperty.Register("Status", GetType(String), GetType(StatusOverview), New FrameworkPropertyMetadata(New PropertyChangedCallback(AddressOf OnStatusChanged)))

  Public Shared CountProperty As DependencyProperty = DependencyProperty.Register("Count", GetType(Integer), GetType(StatusOverview))
  'Public Shared HoursProperty As DependencyProperty = DependencyProperty.Register("Hours", GetType(Double), GetType(StatusOverview))
  Public Shared StatusProperty As DependencyProperty = DependencyProperty.Register("Status", GetType(String), GetType(StatusOverview))

  Public Sub New()
    InitializeComponent()
  End Sub

  Public Property Status() As String
    Get
      Return CType(GetValue(StatusProperty), String)
    End Get
    Set(ByVal value As String)
      SetValue(StatusProperty, value)
    End Set
  End Property

  Public Property Count() As Integer
    Get
      Return CType(GetValue(CountProperty), Integer)
    End Get
    Set(ByVal value As Integer)
      SetValue(CountProperty, value)
    End Set
  End Property

  Public Property Hours() As Double
    Get
      Return CType(GetValue(HoursProperty), Double)
    End Get
    Set(ByVal value As Double)
      SetValue(HoursProperty, value)
    End Set
  End Property

  Private Shared Sub OnHoursChanged(ByVal sender As DependencyObject, ByVal e As DependencyPropertyChangedEventArgs)
    Dim statusO As StatusOverview
    statusO = CType(sender, StatusOverview)

    If CDbl(e.NewValue) > 0 Then
      statusO.HoursLabel.Content = e.NewValue
    Else
      statusO.HoursLabel.Content = ""
    End If

  End Sub

End Class
